var http = require('http');
var optfile = require('./models/optfile');

http.createServer(function(request, response){
	response.writeHead(200,{'Content-Type':'text/html;charset=utf-8'})
	// 同步读取
	// optfile.readfileSync('./view/login.html');

	// 异步读取
	optfile.readfile('./view/login.html',recall);

	function recall(data){
		response.write(data);
		response.end('ok');//不写没有http协议尾
	}
	
	console.log('主程序执行完毕');
}).listen(8000);
console.log('Server is running at http://127.0.0.1:8000');